﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ChinaClipping.ClippingMaster.Editor
{
    public partial class Dlg_Options : Form
    {
        public Dlg_Options()
        {
            InitializeComponent();
        }

        private void Dlg_Options_Load(object sender, EventArgs e)
        {
            textBox_DefaultAd.Text = Properties.Settings.Default.DefaultAd;
            textBox_DefaultHeight.Text  = Properties.Settings.Default.DefaultHeight;
            textBox_DefaultPage.Text  = Properties.Settings.Default.DefaultPage;
            textBox_DefaultPagesize.Text  = Properties.Settings.Default.DefaultPagesize;
            textBox_DefaultWidth.Text  = Properties.Settings.Default.DefaultWidth;
            radioButton_AutoCount.Checked = Properties.Settings.Default.AutoCountWords;
            numericUpDown_DefaultWords.Value =(decimal) Properties.Settings.Default.DefaultWords;
        }

        private void OK_Button_Click(object sender, EventArgs e)
        {
            
            Properties.Settings.Default.DefaultAd = textBox_DefaultAd.Text;
            Properties.Settings.Default.DefaultHeight = textBox_DefaultHeight.Text ;
            Properties.Settings.Default.DefaultPage = textBox_DefaultPage.Text ;
            Properties.Settings.Default.DefaultPagesize = textBox_DefaultPagesize.Text;
            Properties.Settings.Default.DefaultWidth = textBox_DefaultWidth.Text;
            Properties.Settings.Default.DefaultWords = (int)numericUpDown_DefaultWords.Value; 
            Properties.Settings.Default.AutoCountWords = radioButton_AutoCount.Checked;
            Properties.Settings.Default.Save();
            this.Close();
        }

        private void Cancel_Button_Click(object sender, EventArgs e)
        {
            this.Close();
        }

 

        private void radioButton_InsertDefault_CheckedChanged(object sender, EventArgs e)
        {
            numericUpDown_DefaultWords.Enabled = radioButton_InsertDefault.Checked;
        }
    }
}
